home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)t8.d64
/
mastermind.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
3KB
|
111 lines
1 REM**REVISION OF THE VIC 20 PROGRAM FROM THE TORONTO PET USERS GROUP
2 REM**CONVERTED TO THE COMMODORE 64 BY ROGER D BURGE,#2667,TPUG,CANADA
5 POKE53281,1:POKE53280,1:GOSUB20000
10 PRINT"[147]":FORT=1TO10:PRINT"[144]"RIGHT$(STR$(T),2)"":NEXTT
19 CH=PEEK(648)*256:CO=55296
20 CO=CO+43:CH=CH+43:PO=1
30 FORT=COTOCO+763STEP80:FORL=0TO13:POKET+L,.:NEXTL,T
99 PRINT"[149] MASTERMIND "
100 FORT=1TO6:CN(T)=INT(RND(1)*6)+3:NEXTT
105 FORT=1TO6:MN(T)=0:NEXTT
110 GETA$:A=VAL(A$)
120 IF A$=CHR$(13)THEN500
124 IF A$="."THEN212
127 IF A$=","THEN312
130 IF A$=" " OR A$="" THEN 180
133 IF A$="[133]"THEN400
134 IF A$="[140]"THEN9000
135 IF A$=CHR$(20) OR A$="[157]" THEN 200
140 POKECH-1+PO,160:FORT=1TO7:NEXTT:POKECH-1+PO,81
150 IF A<3 OR A>8 THEN 110
160 MN(PO)=A
170 POKE CO-1+PO,A-1
180 PO=PO+1:IF PO=7 THEN PO=1
190 GOTO110
200 PO=PO-1:IF PO=0 THEN PO=6
210 GOTO110
212 T=PO+1:IFT=7THENT=1
214 REM IF MN(PO)<1 OR MN(T)<1THEN110
216 IFMN(PO)=0 THENMN(PO)=1
218 IFMN(T)=0 THENMN(T)=1
220 T=MN(PO):MN(PO)=MN(PO+1):IFPO+1=7THENMN(PO)=MN(1)
230 MN(PO+1)=T:IFPO+1=7THENMN(1)=T
240 POKECO-1+PO,(MN(PO))-1
250 T=PO+1
260 IF T=7 THEN T=1
270 POKECO-1+T,(MN(T))-1
280 GOTO 110
312 T=PO-1:IFT=0THENT=6
314 REM IF MN(PO)<1 OR MN(T)<1THEN110
316 IFMN(PO)=0 THENMN(PO)=1
318 IFMN(T)=0 THENMN(T)=1
320 T=MN(PO):MN(PO)=MN(PO-1):IFPO-1=0THENMN(PO)=MN(6)
330 MN(PO-1)=T:IFPO-1=0THENMN(6)=T
340 POKECO-1+PO,(MN(PO))-1
350 T=PO-1
360 IF T=0 THEN T=6
370 POKECO-1+T,(MN(T))-1
380 GOTO 110
400 FORT=1TO6:IFR(T)<3 THEN 110
404 NEXTT
410 FOR T=1TO6:POKECH-1+T,81:POKECO-1+T,R(T)-1:MN(T)=R(T):NEXTT
430 GOTO110
500 FORT=1TO6:IFMN(T)<3 THEN 110
507 R(T)=MN(T)
510 NEXTT
515 BL=0:WH=0
520 FORT=1TO6:CX(T)=CN(T):NEXTT
530 FORT=1TO6
540 IF MN(T)=CX(T)THENBL=BL+1:CX(T)=9:MN(T)=9
550 NEXT T
560 FORT=1TO6
570 FORL=1TO6
575 IF MN(T)=9THEN600
580 IF MN(T)=CX(L)THENWH=WH+1:CX(L)=9:GOTO600
590 NEXTL
600 NEXTT
610 IF BL=0 THEN 650
620 FORT=1TOBL:POKECH+7+T,81:NEXTT
650 IF WH=0 THEN 700
660 FORT=1TOWH:POKECH+7+BL+T,87:NEXTT
700 CH=CH+80:CO=CO+80:PO=1
705 IF BL=6THEN9050
710 IF CH>1824THEN9000
720 GOTO 105
1981 BILL KRIEGER
9000 PRINT"[152]YOU LOSE.":F=10000
9010 PRINT"[144]THE SOLUTION IS: ";:FORT=1TO6:POKE646,CN(T)-1:PRINT"[209]";:NEXT
9020 GOTO9500
9050 PRINT"YOU GOT IT!":F=5000
9500 ZZ=(ZZ+1)AND15:POKE646,ZZ:PRINT"PLAY AGAIN? (Y/N)":FORT=.TO9:NEXT:GETA$:IFA$=""THEN9500
9501 IFA$="Y"THEN10
9502 PRINT"[147]":END
10000 FORT=1 TO 6:POKE8145+T-1,81:NEXTT
10005 FORT=1TO6:R(T)=0:NEXTT
10010 FORT=1TOF:NEXTT:GOTO10
20000 PRINT"[149][147] MASTERMIND [144]"
20005 PRINT"THE OBJECT OF THE GAME IS TO GUESS THE"
20015 PRINT"COLORS THE VIC HAS";
20020 PRINT" CHOSEN AND THE ";
20025 PRINT"SIX POSITIONS IN";
20030 PRINT" WHICH THEY GO."
20040 PRINT"THE COLORS ARE"
20045 PRINT"RED [159]CYAN [156]PURPLE GREEN BLUE [144]AND [158]YELLOW[144]"
20046 PRINT"USE THE KEYS 3-8 (RED - YELLOW) TO ENTERTHE COLOR YOU DESIRE."
20047 PRINT"HIT RETURN[146] WHEN YOU'VE FINISHED YOUR GUESS."
20048 PRINT"A [209] MEANS YOU HAVE A RIGHT COLOR IN THE RIGHT POSITION."
20049 PRINT"A [215] MEANS YOU HAVE A RIGHT COLOR IN THE WRONG POSITION."
20055 PRINT"PRESS RETURN[146] TO CONT.[144]"
20056 GET A$:IF A$=CHR$(13)THENGOSUB21000:GOTO20058
20057 GOTO 20056
20058 PRINT" USE THE SPACE[146] AND CRSR RIGHT[146] TO MOVE RIGHT. THE DELETE[146] AND ";
20059 PRINT"CRSR LEFT[146] TO MOVELEFT. THE <[146] IS USED FOR EXCHANGING WITH THE ";
20060 PRINT" DOT TO THE LEFT OF THE CURSOR AND THE >[146] TO EXCHANGE WITH THE DOT ";
20065 PRINT" TO THE RIGHT OF THE CURSOR."
20070 PRINT"PRESSING F1[146] WILL RECALL YOUR LAST GUESS."
20072 PRINT"PRESSING F8[146] WILL FORFEIT THE GAME."
20074 PRINT"PRESS RETURN[146] TO PLAY.[144]"
20075 GET A$:IFA$=CHR$(13)THEN RETURN
20080 GOTO 20075
21000 PRINT"[147][149] MASTERMIND [144]":RETURN